package com.liangzhong.modules.trainingcamp.command
{
	import com.liangzhong.constants.NotificationConstants;
	import com.liangzhong.model.type.BuildingType;
	import com.liangzhong.proxy.trainingcamp.TrainingcampProxy;
	import com.liangzhong.proxyconstant.trainingcamp.TrainingcampConstant;
	
	import org.puremvc.as3.interfaces.INotification;
	import org.puremvc.as3.patterns.command.SimpleCommand;

	/**
	 *训练营 
	 * @author Administrator
	 * 
	 */	
	public class TrainingcampCommand extends SimpleCommand
	{
		public function TrainingcampCommand()
		{
			super();
		}
		override public function execute(notification:INotification):void
		{
			switch(notification.getName())
			{
				case TrainingcampConstant.TRAININGCAMPE_MEDIATORTOCOMMAND:
					meditortocommand(notification);
					break;
//				case NotificationConstants.COMMON_DROP_TIME://返回清除球员中心冷却时间
//					if(notification.getBody() == BuildingType.TRAIN)
//					{
//						var proxy:TrainingcampProxy = facade.retrieveProxy(TrainingcampProxy.PROXYNAME) as TrainingcampProxy;
//						proxy.getClearUpTime(notification.getBody());
//					}
			}
		}
		/**
		 * mediator 到 command处理
		 * @param no
		 * 
		 */
		private function meditortocommand(notification:INotification):void
		{
			var proxy:TrainingcampProxy = facade.retrieveProxy(TrainingcampProxy.PROXYNAME) as TrainingcampProxy;
			switch(notification.getType())
			{
				case TrainingcampConstant.START_TRAINING:
					proxy.requestStartTraining(notification.getBody());
					break;
				case TrainingcampConstant.TRAININGCAMPINFO:
					proxy.requestTrainingInfo();
					break;
				case TrainingcampConstant.CLEAR_UP_TIME:
					proxy.requestClearUpTime(notification.getBody());
					break;
				case TrainingcampConstant.BUY_TRAINING_TIME:
					proxy.addTriningTime(notification.getBody());
					break;
			}
		}
	}
}